#!/usr/bin/env jruby

ENV['BUNDLE_GEMFILE'] ||= File.join(Dir.pwd, 'Gemfile')

$stdout.sync = true
$stderr.sync = true

at_exit do
  $stdout.flush
  $stderr.flush
  sleep 1
end

require 'rubygems'
require 'bundler/setup'

# Because of how Spring application is started from within RSpec, the
# process will not finish, if all RSpec tests pass. Look at code in
# rspec-core/lib/rspec/core/runner.rb#self.invoke to understand
# why.

require 'rspec/core'
RSpec::Core::Runner.disable_autorun!
exit RSpec::Core::Runner.run ARGV
